const Koa = require('koa');
const bodyParser = require('koa-bodyparser')
const routing = require('./router/index')
const log = require('./log/logger')
const run = require('./db/index')


const app = new Koa();


// 错误处理中间件
app.on('error', (err, ctx) => {
  console.error('Server Error', err, ctx);
});

app.use(log())
app.use(bodyParser())


routing(app)

run()

app.listen(3000, () => console.log('listening on port 3000'));


